package com.study.app;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * @author sjw
 * @className Test
 * @date 2021/4/7 18:19
 * @description: TODO
 */
public class Test {
    public static void main(String[] args) {
        String ss = "张会芳-市场运营二部-L4";
        if (ss.contains("-"))
            System.out.println(ss.substring(0, ss.indexOf("-")));
        System.out.println("aaa".indexOf("-"));

        System.out.println(
                Calendar.getInstance().get(Calendar.DAY_OF_MONTH));
        //aaa();

        Calendar calendar = Calendar.getInstance();
        System.out.println(calendar.get(Calendar.YEAR));
        calendar.set(Calendar.MONTH,11);
        calendar.set(Calendar.DAY_OF_MONTH,19);
        calendar.set(Calendar.HOUR_OF_DAY, 23);
        calendar.set(Calendar.MINUTE, 59);
        calendar.set(Calendar.SECOND, 59);
        SimpleDateFormat df1 = new SimpleDateFormat("yyyy-MM-dd");
        System.out.println(df1.format(calendar.getTime()));
        //SimpleDateFormat df1 = new SimpleDateFormat("yyyy-MM-dd");
        calendar.add(Calendar.MONTH, 1);
        System.out.println(df1.format(calendar.getTime()));
    }

    public static void aaa() {
        System.out.println("------------------");
        Calendar calendar = Calendar.getInstance();
        System.out.println(calendar.get(Calendar.YEAR));
        calendar.set(Calendar.DAY_OF_MONTH,19);
        calendar.set(Calendar.HOUR_OF_DAY, 23);
        calendar.set(Calendar.MINUTE, 59);
        calendar.set(Calendar.SECOND, 59);
        SimpleDateFormat df1 = new SimpleDateFormat("yyyy-MM-dd");
        System.out.println(df1.format(calendar.getTime()));
        calendar.set(Calendar.HOUR_OF_DAY, 24);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);

        System.out.println(df1.format(calendar.getTime()));


        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        Date start = null, end = null;
        start=calendar.getTime();
        System.out.println("month"+calendar.get(Calendar.YEAR));
        calendar.add(Calendar.MONTH,-1);
        end=calendar.getTime();
//        int date = calendar.get(Calendar.DAY_OF_MONTH);
//        if (date <= 9)
//            calendar.add(Calendar.MONTH, -1);

        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        System.out.println(df.format(start));
        System.out.println(df.format(end));
        System.out.println(start.toString());
        long a=1619366400000L;
        long b=1617206400000L;
        int aa=  (int)((a-b)/1000/60/60/24);
        System.out.println(aa);

        Date ss=new Date();
        System.out.println(ss);
        System.out.println(ss.getDate());
        System.out.println(ss.getMonth());
        System.out.println(ss.getYear()+1900);
    }
}
